import Vue from "vue";
import VueRouter, { RouteConfig } from "vue-router";

import Layout from "@/views/Layout.vue"
import GoodsInfo from "@/views/GoodsInfo.vue"
import Erro from "@/views/Erro.vue"

Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
  {
    path: "/",
    component: Layout,
    redirect: '/goods',
    children: [
      {
        path: '/goods',
        component: () => import('@/views/goods/Goods.vue')
      },
      {
        path: '/rating',
        component: () => import('@/views/rating/Rating.vue')
      },
      {
        path: '/seller',
        component: () => import('@/views/seller/Seller.vue')
      },

    ]
  },
  {
    path: "/goodsInfo",
    name: "goodsInfo",
    component: GoodsInfo,

  },
  {
    path: "*",
    component: Erro,
  },


];

const router = new VueRouter({
  routes,
});

export default router;
